/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SWANLINK_FINANCE_UTILS_ICCREADER_HILOG_WRAPPER_H_
#define SWANLINK_FINANCE_UTILS_ICCREADER_HILOG_WRAPPER_H_

#include "hilog/log.h"
#include "hilog_wrapper.h"
namespace SwanLink {
namespace Finance {

#define FINANCE_DOMAIN_ICCREADER(offset)  FINANCE_DOMAIN_BASE(5, offset)
#ifdef ICCREADER_HILOGF
#undef ICCREADER_HILOGF
#endif

#ifdef ICCREADER_HILOGE
#undef ICCREADER_HILOGE
#endif

#ifdef ICCREADER_HILOGW
#undef ICCREADER_HILOGW
#endif

#ifdef ICCREADER_HILOGI
#undef ICCREADER_HILOGI
#endif

#ifdef ICCREADER_HILOGD
#undef ICCREADER_HILOGD
#endif

enum ICCREADER_MODULE {
    ICCREADER_UTIL = 0,
    ICCREADER_KITS,
    ICCREADER_INNERKITS,
    ICCREADER_JS_NAPI,
    ICCREADER_SRV,
    ICCREADER_ADAPTOR,
    ICCREADER_TEST,
    ICCREADER_BUTT
};
// In order to improve performance, do not check the module range.

static constexpr OHOS::HiviewDFX::HiLogLabel ICCREADER_LABEL[ICCREADER_BUTT] = {
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_UTIL),            "IccreaderUtils"},
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_KITS),            "IccreaderKits"},
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_INNERKITS),       "IccreaderInnerKits"},
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_JS_NAPI),         "IccreaderJsNapi"},
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_SRV),             "IccreaderSrv"},
     {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_ADAPTOR),        "IccreaderAdaptor"},
    {LOG_CORE, FINANCE_DOMAIN_ICCREADER(ICCREADER_TEST),            "IccreaderTest"}
};

// Besides, make sure module is less than POWERMGR_MODULE_BUTT.
#define ICCREADER_HILOGF(module, ...) (void)OHOS::HiviewDFX::HiLog::Fatal(ICCREADER_LABEL[module], __FORMATED(__VA_ARGS__))
#define ICCREADER_HILOGE(module, ...) (void)OHOS::HiviewDFX::HiLog::Error(ICCREADER_LABEL[module], __FORMATED(__VA_ARGS__))
#define ICCREADER_HILOGW(module, ...) (void)OHOS::HiviewDFX::HiLog::Warn(ICCREADER_LABEL[module], __FORMATED(__VA_ARGS__))
#define ICCREADER_HILOGI(module, ...) (void)OHOS::HiviewDFX::HiLog::Info(ICCREADER_LABEL[module], __FORMATED(__VA_ARGS__))
#define ICCREADER_HILOGD(module, ...) (void)OHOS::HiviewDFX::HiLog::Debug(ICCREADER_LABEL[module], __FORMATED(__VA_ARGS__))

} // namespace Finance
} // namespace SwanLink

#endif // SWANLINK_FINANCE_UTILS_ICCREADER_HILOG_WRAPPER_H_
